package model;

import java.util.List;

public class Player implements IPlayer {
	private String name;
	private String sessionId;
	private String status = "Waiting";
	private String assignment = "New Player";
	private String avatar;
	private Card[] cards = new Card[2];
	private RankingEnum rankingEnum = null;
	private List<Card> rankingList = null;
	private Card highCard = null;
	private int currentBet = 0;
	private int money = 10000;
	private boolean isTurn = false;

	public Player(String name, String sessionId, String avatar){
		this.name = name;
		this.sessionId = sessionId;
		this.setAvatar(avatar);
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Card getHighCard() {
		return highCard;
	}

	public void setHighCard(Card highCard) {
		this.highCard = highCard;
	}

	public RankingEnum getRankingEnum() {
		return rankingEnum;
	}

	public void setRankingEnum(RankingEnum rankingEnum) {
		this.rankingEnum = rankingEnum;
	}

	public List<Card> getRankingList() {
		return rankingList;
	}

	public void setRankingList(List<Card> rankingList) {
		this.rankingList = rankingList;
	}

	public Card[] getCards() {
		return cards;
	}

	public void setCards(Card[] cards) {
		this.cards = cards;
	}
	
	public String print() {
		String rank = "";
		if(getRankingEnum() != null)
			rank= getRankingEnum().toString();
		
		if(rank.equals("HIGH_CARD")) {
			return "High Card " + getHighCard().getRank().toString();
		}else if(rank.equals("ONE_PAIR")) {
			return "Pair of " + getRankingList().get(0).getRank().toString();
		} else if(rank.equals("TWO_PAIR")) {
			return getRankingList().get(0).getRank().toString() + "s and " + getRankingList().get(2).getRank().toString() + "s";
		} else if(rank.equals("THREE_OF_A_KIND")) {
			return "Three " + getRankingList().get(0).getRank().toString() + "s";
		} else if(rank.equals("STRAIGHT")) {
			return "Straight to " + getRankingList().get(4).getRank().toString();
		} else if(rank.equals("FLUSH")) {
			return "Flush to " + getRankingList().get(4).getRank().toString();
		} else if(rank.equals("FULL_HOUSE")) {
			return getRankingList().get(0).getRank().toString() + "s over " + getRankingList().get(3).getRank().toString() + "s";
		} else if(rank.equals("FOUR_OF_A_KIND")) {
			return "Four " + getRankingList().get(0).getRank().toString() + "s";
		} else if(rank.equals("STRAIGHT_FLUSH")) {
			return "Straight Flush to " + getRankingList().get(4).getRank().toString();
		} else if(rank.equals("ROYAL_FLUSH")) {
			return "Royal Flush";
		}else{
			return "";
		}
	}

	public String getAssignment() {
		return assignment;
	}

	public void setAssignment(String assignment) {
		this.assignment = assignment;
	}

	public int getMoney() {
		return money;
	}

	public void setMoney(int money) {
		this.money = money;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public int getCurrentBet() {
		return currentBet;
	}

	public void setCurrentBet(int currentBet) {
		this.currentBet = currentBet;
	}

	public boolean isTurn() {
		return isTurn;
	}

	public void setTurn(boolean isTurn) {
		this.isTurn = isTurn;
	}

}
